package com.ruoyi.project.system.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 进件查询支付对象 sys_pay_order
 */

@Data
@Accessors(chain = true)
public class SysPayOrder extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Excel(name = "ID")
    private Integer id;

    /**
     * 类型
     */
    @Excel(name = "类型")
    private String type;

    /**
     * 外部商品单号
     */
    @Excel(name = "外部商品单号")
    private String outId;

    /**
     * 本系统系统单号
     */
    @Excel(name = "系统支付单号")
    private String orderNo;

    /**
     * 请求支付金额（订单金额）
     */
    @Excel(name = "请求支付金额（订单金额）")
    private BigDecimal pricing;

    /**
     * 实际支付金额
     */
    @Excel(name = "实际支付金额")
    private BigDecimal actualPayAmount;

    /**
     * 支付平台生成的唯一订单号
     */
    @Excel(name = "支付平台单号")
    private String platformOrderNo;

    /**
     * 实际支付方式
     */
    @Excel(name = "实际支付方式")
    private String payType;

    /**
     * 付款成功标志
     */
    @Excel(name = "付款状态")
    private String payState;

    /**
     * 付款时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "付款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date payTime;


    /**
     * 商品标题
     */
    @Excel(name = "商品标题")
    private String subject;

    /**
     * 商品描述
     */
    @Excel(name = "商品描述")
    private String body;

    /**
     * 删除标志
     */
    @Excel(name = "删除标志")
    private String delSign;

    public SysPayOrder() {
    }

    public SysPayOrder(String orderNo, String payState) {
        this.orderNo = orderNo;
        this.payState = payState;
    }

    public SysPayOrder(String orderNo, String actualPayAmount, String platformOrderNo, String payState, Date payTime) {
        this.orderNo = orderNo;
        this.actualPayAmount = BigDecimal.valueOf(Float.parseFloat(actualPayAmount));
        this.platformOrderNo = platformOrderNo;
        this.payState = payState;
        this.payTime = payTime;
    }
}
